import request from '@/utils/request'

//定义一个常量
const api_name = "/admin/system/sysRole";

export default {
    //创建分页及条件查询的函数
    getPageList(currernt,size,queryVo){
        return request({
            url:`${api_name}/${currernt}/${size}`,
            method:"get",
            params:queryVo
        });
    },
    //添加角色
    save(sysRole){
        return request({
            url:`${api_name}/add`,
            method:"post",
            data:sysRole
        });
    },
    //根据id删除角色
    deleteById(id){
        return request({
            url:`${api_name}/delete/${id}`,
            method:"delete"
        });
    },
    //根据id查询角色
    getById(id){
        return request({
            url:`${api_name}/getById/${id}`,
            method:"get"
        });
    },
    //更新角色
    update(sysRole){
        return request({
            url:`${api_name}/update`,
            method:"put",
            data:sysRole
        });
    },
    //批量删除
    batchDelete(ids){
        return request({
            url:`${api_name}/deleteAll`,
            method:"delete",
            data:ids
        });
    },
    //去分配角色的页面
    getRolesByUserId(userId){
        return request({
            url:`${api_name}/getRolesByUserId/${userId}`,
            method:"get"
        });
    },
    //分配角色
    assignRoles(assignRoleVo){
        return request({
            url:`${api_name}/assignRoles`,
            method:"post",
            data:assignRoleVo
        });
    }
}